Skip to content

Conversation

@TimTaylor
Copy link
Contributor

Adds an argument to implicit_assignment_linter to disable linting of ( for auto-printing.
closes #2916

* `object_usage_linter()` lints missing packages that may cause false positives (#2872, @AshesITR)
* New argument `include_s4_slots` for the `xml_find_function_calls()` entry in the `get_source_expressions()` to govern whether calls of the form `s4Obj@fun()` are included in the result (#2820, @MichaelChirico).
* `sprintf_linter()` lints `sprintf()` and `gettextf()` calls when a constant string is passed to `fmt` (#2894, @Bisaloo).
* `implicit_assignment_linter()` gains argument `allow_print` to disable lints for the use of `(` for auto-printing (#2919, @TimTaylor).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think allow_implicit_print may be better, WDYT? My only hesitation is doubling "implicit" in the linter & argument names...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow_bracket_print?

I'm already wary of implicit as a description as it already doesn't reflect how I think of my usage of this lint ... basically "stop people accidentally using <- in function calls". I'd prefer not to use the term more if possible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it allow_paren_print

@codecov
Copy link

codecov bot commented Aug 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.24%. Comparing base (2b70b52) to head (6181509).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2919   +/-   ##
=======================================
  Coverage   99.24%   99.24%           
=======================================
  Files         129      129           
  Lines        7282     7285    +3     
=======================================
+ Hits         7227     7230    +3     
  Misses         55       55           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AshesITR
Copy link
Collaborator

Feels like a false positive to me - maybe we don't need an argument for this?

IINM this only removes top-level (x <- expr) lints, right?

@TimTaylor
Copy link
Contributor Author

TimTaylor commented Aug 11, 2025

Feels like a false positive to me - maybe we don't need an argument for this?

That would be great but the custom print error message seems like it was a deliberate choice to lint for.

IINM this only removes top-level (x <- expr) lints, right?

I believe so (but take my agreement with caution as I deliberately avoided delving in to the XPath logic due to the pre-existing custom error).

@AshesITR
Copy link
Collaborator

Oh, I see, sorry.

MichaelChirico and others added 16 commits September 15, 2025 14:11
* Fix false positive for null coalescing without else clause

Signed-off-by: Emmanuel Ferdman <[email protected]>

* cite in NEWS

---------

Signed-off-by: Emmanuel Ferdman <[email protected]>
Co-authored-by: Michael Chirico <[email protected]>
* Partial fix for upcoming testthat release

`expect_success()` and `expect_failure()` now test that you have exactly one success/failure and zero failures/successes. I can't quite figure out why the tests are still failing here; maybe it's something to do with recycling? I'm happy to help but I unfortunately I don't know enough about the lintr internals to figure out what's going wrong here.

We're planning to submit testthat to CRAN on Nov 10.

* simple delint

* extract to helper for cyclo complexity

* avoid testthat::expect() again

* fail() needs return()

---------

Co-authored-by: Michael Chirico <[email protected]>
* Don't lint T and F if followed by `[`.

* Address review comments.

* subsume into same expr[] as $ and @

---------

Co-authored-by: Michael Chirico <[email protected]>
* Lint nrow, ncol, NROW and NCOL with logical expressions.

* Address review comments.

* Fix indentation.

* tidy up tests

---------

Co-authored-by: Michael Chirico <[email protected]>
* Make the message from cyclocomp_linter() more actionable.

* Revert output changes.

---------

Co-authored-by: Michael Chirico <[email protected]>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@TimTaylor
Copy link
Contributor Author

Sorry, rebased in my branch and have messed this up. Will resubmit and reference this.

@TimTaylor TimTaylor closed this Oct 29, 2025
TimTaylor added a commit to TimTaylor/lintr that referenced this pull request Oct 29, 2025
MichaelChirico pushed a commit that referenced this pull request Oct 29, 2025
* feat: argument to disable linting of ( for auto-printing

closes #2916

supersedes #2919

* update NEWS

* tweak argument description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: add argument to disable linting of ( for auto-printing in implicit_assignment_linter

7 participants